package com.yupi.springbootinit.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @TableName conurse_classify
 */
@TableName(value ="conurse_classify")
@Data
public class ConurseClassify implements Serializable {
    @TableId
    private Long id;

    private String name;

    @TableField("parent_id")
    private Long parentId;

    @TableField("cascade_id")
    private String cascadeId;

    @TableField("cascade_order")
    private Long cascadeOrder;

    @TableField("cascade_img")
    private String cascadeImg;

    @TableField("cascade_describe")
    private String cascadeDescribe;

    @TableField("icon")
    private String icon;

    private String status;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private Date updateTime;

    @TableField("is_deleted")
    private Integer isDeleted;

    // @TableField(exist = false)
    // private ConurseClassify children;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ConurseClassify other = (ConurseClassify) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getCascadeId() == null ? other.getCascadeId() == null : this.getCascadeId().equals(other.getCascadeId()))
            && (this.getCascadeOrder() == null ? other.getCascadeOrder() == null : this.getCascadeOrder().equals(other.getCascadeOrder()))
            && (this.getCascadeImg() == null ? other.getCascadeImg() == null : this.getCascadeImg().equals(other.getCascadeImg()))
            && (this.getCascadeDescribe() == null ? other.getCascadeDescribe() == null : this.getCascadeDescribe().equals(other.getCascadeDescribe()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getCascadeId() == null) ? 0 : getCascadeId().hashCode());
        result = prime * result + ((getCascadeOrder() == null) ? 0 : getCascadeOrder().hashCode());
        result = prime * result + ((getCascadeImg() == null) ? 0 : getCascadeImg().hashCode());
        result = prime * result + ((getCascadeDescribe() == null) ? 0 : getCascadeDescribe().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", parentId=").append(parentId);
        sb.append(", cascadeId=").append(cascadeId);
        sb.append(", cascadeOrder=").append(cascadeOrder);
        sb.append(", cascadeImg=").append(cascadeImg);
        sb.append(", cascadeDescribe=").append(cascadeDescribe);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
